import { parse } from 'querystring';
/* eslint no-useless-escape:0 import/prefer-default-export:0 */

const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
export const isUrl = path => reg.test(path);

export const isDev = () => {
  const { NODE_ENV } = process.env;

  return NODE_ENV === 'development';
};
export const getPageQuery = () => parse(window.location.href.split('?')[1]);

export const ModalStatus = {
  closed: 'closed',
  add: 'add',
  update: 'update',
  display: 'display',
};
